﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WebPiket3Csv
{
    /// <summary>
    /// Логика взаимодействия для Page1_Files.xaml
    /// </summary>
    public partial class Page1_Files : Page
    {
        public Page1_Files()
        {
            InitializeComponent();
        }

        public string Openfile()
        {
            string filename = ""; 
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".csv";
            dlg.Filter = "Auriga csv (.csv)|*.csv";

            // Display OpenFileDialog by calling ShowDialog method
            Nullable<bool> result = dlg.ShowDialog();

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                filename = dlg.FileName;
            }
            return filename;
        }


        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            PrjProperty.fileNamePkt = Openfile();
            txtFilePkt.Text = PrjProperty.fileNamePkt;
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            PrjProperty.fileNameSts = Openfile();
            txtFileSts.Text = PrjProperty.fileNameSts;
        }

		void txtFilePkt_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Button_Click_1(sender, e);
		}

		void txtFileSts_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Button_Click_2(sender, e);
		}
    }
}
